<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1 id="hh"></h1>
</body>

</html>
<script>
    let arr = ['333', '444', '555'];

    let proxy = new Proxy(arr,{
        //target是包装的目标对象
        //prop是访问的属性名(key)
        get(target,key){
            console.log(target,key)
            document.getElementById('hh').innerHTML = JSON.stringify(target)
            return target[key]
        },
        //key设置的属性名
        //value设置的属性值
        set(target,key,value){
            console.log(target,key,value)
            target[key] = value
            document.getElementById('hh').innerHTML = JSON.stringify(target)
        }
    })
    console.log(proxy)
</script>